﻿<%@ Page Language="C#" MasterPageFile="~/MMhome.Master" AutoEventWireup="true" CodeBehind="InfoManager.aspx.cs"
    Inherits="MobileManager.InfoManager" Title="短信管理" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

    <script type="text/javascript">
        function CheckADD() {
            var strTarget = document.getElementById('<%=txtTarget.ClientID%>').value.Trim();
            if (strTarget == "") {
                alert("发送目标不能为空！");
                return false;
            }
            var strContent = document.getElementById('<%=txtContent.ClientID%>').value.Trim();
            if (strContent == "") {
                alert("发送内容不能为空！");
                return false;
            }
            return true;
        }
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderMain" runat="server">
    <div style="width: 100%; text-align: center; margin-top: 10px; font-size: 12px;">
        <table>
            <tr>
                <td>
                    发送目标：
                </td>
                <td>
                    <asp:TextBox ID="txtTarget" runat="server" MaxLength="30"></asp:TextBox>
                </td>
                <td>
                    发送内容：
                </td>
                <td>
                    <asp:TextBox ID="txtContent" runat="server" MaxLength="200"></asp:TextBox>
                </td>
                <td>
                    状态：
                </td>
                <td>
                    <asp:DropDownList ID="ddlStatus" runat="server">
                        <asp:ListItem Value="1" Text="启用"></asp:ListItem>
                        <asp:ListItem Value="2" Text="禁用"></asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    &nbsp;&nbsp;&nbsp;<asp:Button ID="btnAdd" runat="server" Text="添 加" CssClass="button_blue"
                        OnClick="btnAdd_Click" OnClientClick="return CheckADD();" />
                </td>
            </tr>
        </table>
    </div>
    <asp:GridView ID="GVinfo" runat="server" AutoGenerateColumns="False" CssClass="reason_box"
        Font-Size="12px" CellPadding="0" BorderWidth="0px" BorderColor="#A6E1FF" Width="100%"
        OnRowDataBound="GVinfo_RowDataBound" OnRowCancelingEdit="GVinfo_RowCancelingEdit"
        OnRowDeleting="GVinfo_RowDeleting" OnRowEditing="GVinfo_RowEditing" OnRowUpdating="GVinfo_RowUpdating">
        <Columns>
            <asp:TemplateField HeaderText="发送目标">
                <EditItemTemplate>
                    <asp:TextBox ID="txtTarget" runat="server" Text='<%#Eval("Target") %>' MaxLength="30"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lbTarget" runat="server" Text='<%# Bind("Target") %>'></asp:Label>
                </ItemTemplate>
                <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="发送内容">
                <EditItemTemplate>
                    <asp:TextBox ID="txtContent" runat="server" Width="160" Text='<%# Bind("Content") %>'
                        MaxLength="200"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lbContent" runat="server" Text='<%# Bind("Content") %>'></asp:Label>
                </ItemTemplate>
                <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="状态">
                <EditItemTemplate>
                    <asp:DropDownList ID="ddlStatus" runat="server">
                        <asp:ListItem Value="1" Text="启用"></asp:ListItem>
                        <asp:ListItem Value="2" Text="禁用"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:HiddenField ID="hdfStatus" runat="server" Value='<%#Eval("Status") %>' />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lbStatus" runat="server"></asp:Label>
                </ItemTemplate>
                <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="管理">
                <EditItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
                        Text="更新"></asp:LinkButton>
                    &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
                        Text="取消"></asp:LinkButton><asp:HiddenField ID="HF1" runat="server" Value='<%#Eval("ID") %>' />
                    <asp:HiddenField ID="hdfTarget" runat="server" Value='<%#Eval("Target") %>' />
                    <asp:HiddenField ID="hdfContent" runat="server" Value='<%#Eval("Content") %>' />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
                        Text="编辑"></asp:LinkButton>
                    &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Delete"
                        Text="删除" OnClientClick="return confirm('确定要删除?')"></asp:LinkButton><asp:HiddenField
                            ID="HF2" runat="server" Value='<%#Eval("ID") %>' />
                </ItemTemplate>
                <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" Width="80px" />
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
            <span style="color: Red; font-weight: bold;">没有数据！</span>
        </EmptyDataTemplate>
    </asp:GridView>
</asp:Content>
